package com.lulu.baselib.dialog;

import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;


import com.lulu.baselib.R;

import butterknife.ButterKnife;

/**
 * Author: XuChang
 * Date: 2019/10/27 1:25
 * Email: 123286473@qq.com
 * Description:
 * History:
 */
public abstract class BaseDialogFragment extends DialogFragment {

    protected abstract @LayoutRes
    int getLayoutId();

    protected abstract void initView(View view);

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View inflate = inflater.inflate(getLayoutId(), container);
        getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        setStyle(DialogFragment.STYLE_NO_TITLE, R.style.CustomAlertDialog);
        ButterKnife.bind(this, inflate);
        initView(inflate);
        return inflate;
    }

}
